package com.ostrich.library_base

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

abstract class BaseActivity<VDB:ViewDataBinding> : AppCompatActivity() {
    var binding:VDB? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DataBindingUtil.setContentView(this,bindLayout())
        initView()
        initData()
        initListener()
    }

    override fun onDestroy() {
        super.onDestroy()
        if(binding != null){
            binding = null
        }
    }

    abstract fun initView()
    abstract fun initData()
    abstract fun initListener()
    abstract fun bindLayout():Int
}